﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace DataSetGen
{
    internal static class ConsoleUtil
    {
        public static void PrintMessage(String message, TraceLevel level)
        {
            if (level == TraceLevel.Verbose && !Program.Parameters.Verbose)
                return;

            ConsoleColor defColor = Console.ForegroundColor;

            try
            {
                switch (level)
                {
                    case TraceLevel.Info:
                        Console.ForegroundColor = ConsoleColor.Green;
                        break;
                    case TraceLevel.Error:
                        Console.ForegroundColor = ConsoleColor.Red;
                        break;
                    case TraceLevel.Off:
                        Console.ForegroundColor = defColor;
                        break;
                    case TraceLevel.Verbose:
                        Console.ForegroundColor = ConsoleColor.White;
                        break;
                    case TraceLevel.Warning:
                        Console.ForegroundColor = ConsoleColor.Yellow;
                        break;
                }
                Console.WriteLine(message);
            }
            finally
            {
                Console.ForegroundColor = defColor;
            }
        }
    }
}
